/* Copyright (c) 2004-2024 Peigen.info. All rights reserved. */

package info.peigen.hotpot.component.gateway.dianlan.protocol.passive;

import info.peigen.hotpot.component.gateway.dianlan.annotations.DianlanProtocol;
import info.peigen.hotpot.component.gateway.dianlan.facade.enums.DianlanStubApplyChargeFailReason;
import info.peigen.hotpot.component.gateway.dianlan.facade.enums.DianlanSuccessSign;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import lombok.experimental.FieldDefaults;
import lombok.experimental.SuperBuilder;

import static info.peigen.hotpot.component.gateway.dianlan.annotations.DianlanProtocol.DianlanProtocolDataType.*;

/**
 * <b>(DianlanStubApplyChargeResponse)</b>
 * <p>
 * 充电桩主动申请启动充电-应答
 * 启动充电鉴权结果
 * 帧类型码 0x32
 * 序列号域 0004
 * 数据长度 2A(42)
 * 帧校验域 8E29
 *
 * @author Peigen
 * @version 1.0.0
 * @since 2022/8/11
 */
@SuperBuilder
@Data
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults(level = AccessLevel.PRIVATE)
@Accessors(chain = true)
public class DianlanStubApplyChargeResponse {
    /** 交易流水号 */
    @DianlanProtocol(length = 16, start = 0, end = 16, dataType = BCD)
    String                           transNo;
    /** 桩编码 */
    @DianlanProtocol(length = 7, start = 16, end = 23, dataType = BCD)
    String                           stubNo;
    /** 充电枪号 */
    @DianlanProtocol(length = 1, start = 23, end = 24, dataType = BCD)
    String                           chargingPortNo;
    /** 逻辑卡号 显示在屏幕上，不足 8 位补零 */
    @DianlanProtocol(length = 8, start = 24, end = 32, dataType = BCD)
    String                           logicCardNo;
    /** 账户余额 保留两位小数 */
    @DianlanProtocol(length = 4, start = 32, end = 36, dataType = BIN)
    String                           balance;
    /** 鉴权成功标志 */
    @DianlanProtocol(length = 1, start = 36, end = 37, dataType = ENUM)
    DianlanSuccessSign               authSign;
    /** 失败原因 */
    @DianlanProtocol(length = 1, start = 37, end = 38, dataType = ENUM)
    DianlanStubApplyChargeFailReason failReason;
}